home *** CD-ROM | disk | FTP | other *** search
- /*
- * $RCSfile: recoverServerPreparedTrans.c,v $
- * $Revision: 1.2 $
- * $Date: 1996/05/04 23:51:53 $
- */
- /**********************************************************************
- * EXODUS Database Toolkit Software
- * Copyright (c) 1991 Computer Sciences Department, University of
- * Wisconsin -- Madison
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY OF WISCONSIN --
- * MADISON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.
- * THE DEPARTMENT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
- * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * The EXODUS Project Group requests users of this software to return
- * any improvements or extensions that they make to:
- *
- * EXODUS Project Group
- * c/o David J. DeWitt and Michael J. Carey
- * Computer Sciences Department
- * University of Wisconsin -- Madison
- * Madison, WI 53706
- *
- * or exodus@cs.wisc.edu
- *
- * In addition, the EXODUS Project Group requests that users grant the
- * Computer Sciences Department rights to redistribute these changes.
- **********************************************************************/
-
- #include "sysdefs.h"
- #include "ess.h"
- #include "checking.h"
- #include "trace.h"
- #include "error.h"
- #include "list.h"
- #include "pool.h"
- #include "tid.h"
- #include "io.h"
- #include "lock.h"
- #include "object.h"
- #include "msgdefs.h"
- #include "thread.h"
- #include "semaphore.h"
- #include "link.h"
- #include "lsn.h"
- #include "latch.h"
- #include "bf.h"
- #include "volume.h"
- #include "trans.h"
- #include "openlog.h"
- #include "logrecs.h"
- #include "bitvec.h"
- #include "trans_extfuncs.h"
- #include "trans_intfuncs.h"
- #include "recover_intfuncs.h"
- #include "msg_funcs.h"
- #include "cl_funcs.h"
- #include "thread_funcs.h"
- #include "thread_globals.h"
- #include "trans_globals.h"
- #include "distr.h"
- #include "distr_intfuncs.h"
-
- #ifdef vax
- void
- recoverServerPreparedTrans (
- register TRANSREC *transRec,
- )
- #elif defined(mips) || defined(sparc) || defined(_AIX) || defined(hpux) || defined(linux)
- void
- recoverServerPreparedTrans ()
- #elif !(defined(mips) || defined(sparc) || defined(vax) || defined(_AIX) || defined(hpux) || defined(linux))
- not supported
- #else
- /* this else should have the not supported code, but the
- ultrix cpp is broken */
- #endif
-
- {
- TID localTid;
- TID coordTid;
- /*
- * This variable holds an argument passed the this function
- * when the thread was forked. This should be portable across
- * all architectures but vax's.
- */
- #if defined(mips) || defined(sparc) || defined(_AIX) || defined(hpux) || defined(linux)
- register TRANSREC *transRec;
- #elif defined(vax)
- /* not needed */
- #elif !(defined(mips) || defined(sparc) || defined(vax) || defined(_AIX) || defined(hpux) || defined(linux))
- not supported
- #else
- /* this else should have the not supported code, but the
- ultrix cpp is broken */
- #endif
-
- TRACE(TR_TRANS, TR_LEVEL_1);
-
- /*
- * suck the transrec out of the tcb buffer
- */
- #ifdef mips
- transRec = (TRANSREC *) Active->currentBuf[JB_A0];
- #elif defined(sparc) || defined(_AIX) || defined(hpux) || defined(linux)
- /*
- * Sparc and other architectures
- */
- transRec = (TRANSREC *) Active->args[0];
- #elif defined(vax)
- /* not needed */
- #elif !(defined(mips) || defined(sparc) || defined(vax) || defined(_AIX) || defined(hpux) || defined(linux))
- not supported
- #else
- /* this else should have the not supported code, but the
- ultrix cpp is broken */
- #endif
-
-
- localTid = transRec->tid;
- coordTid = transRec->coordTid;
-
-
- TRPRINT(TR_TRANS, TR_LEVEL_1, ("localTid:%x", localTid));
-
- /*
- * initialize the version, type, coordTid, and localTid of
- * the reply message
- */
- Active->message.header.version = MESSAGE_VERSION;
- Active->message.header.type = SERVER_VOTE;
- Active->message.body.vote.coordTid = coordTid;
- Active->message.body.vote.localTid = localTid;
-
- /*
- * record the vote
- */
- Active->message.body.vote.vote = YESVOTE;
-
- /*
- * mark the active transaction
- */
- Active->transRec = (char *) transRec;
-
- /*
- * fill in the other Active fields
- */
- Active->replyAddr = transRec->coordAddr;
-
- /*
- * mark this thread as the master for this trans
- */
- transRec->masterThread = Active;
-
- /*
- * keep sending the vote until reply is recd
- */
- while (transRec->coordCommand == C_UNKNOWN) {
-
- replyDatagram(esmNOERROR, esmNOERROR, 1, FALSE);
- /*
- * go to sleep on timeout
- */
- Sleep(T_SERVERTIMEOUT);
- }
-
- /*
- * commit/abort based on command
- * reply to coord
- */
- replyWithAck(transRec);
- }
-